﻿@model List<CdlxMessage>
@{
    ViewData["Title"] = "Home Page";
}

<div class="text-center">
    <h1 class="display-4">定时刷新复合死信队列</h1>
</div>
<div>
    <table class="table table-condensed">
        <thead>
            <tr class="table-primary">
                <th>#</th>
                <th>业务类型</th>
                <th>消息内容</th>
                <th>进入时间</th>
                <th>过期时间</th>
            </tr>
        </thead>
        <tbody>
            @for (int i = 0; i < Model.Count; i++)
            {
                var item = Model[i];
                var index = i + 1;
                var cssName = "";
                switch (item.Type)
                {
                    case MessageType.RedPackage: cssName = "danger"; break;
                    case MessageType.Order: cssName = "warning"; break;
                    case MessageType.Vote: cssName = "success"; break;
                }
                <tr class="table-@cssName">
                    <td>@index</td>
                    <td>@item.Type</td>
                    <td>@item.Data</td>
                    <td>@item.CreateTime</td>
                    <td>@item.CreateTime.AddSeconds(item.Expire)</td>
                </tr>
            }
        </tbody>
    </table>
</div>